]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Consolidate window tracking filters between app monitor and overview.
authorSteve Frécinaux <code@istique.net>
Fri, 28 Aug 2009 16:36:23 +0000 (18:36 +0200)
committerSteve Frécinaux <code@istique.net>
Mon, 31 Aug 2009 19:35:23 +0000 (21:35 +0200)
The windows we considered for both the app monitor and the overview
workspaces were the same, but the code was duplicated once in C, once
in Javascript.

js/ui/workspaces.js
src/shell-app-monitor.c
src/shell-app-monitor.h

index 7fa0bb1ac3bdcfdfdf4a98e3cd392ddf15c341b8..59d7ab7e233096cca5b18022bf3adef3f8a3ea49 100644 (file)
@@ -745,11 +745,8 @@ Workspace.prototype = {
 
     // Tests if @win should be shown in the Overview
     _isOverviewWindow : function (win) {
-        let wintype = win.get_window_type();
-        if (wintype == Meta.WindowType.DESKTOP || 
-            wintype == Meta.WindowType.DOCK)
-            return false;
-        return !win.is_override_redirect();
+        let appMon = Shell.AppMonitor.get_default()
+        return appMon.is_window_usage_tracked(win.get_meta_window());
     },
 
     _createWindowIcon: function(window) {
index a6409574a09e077558ecf7c14fff9cd15f24c75f..8548d37d4be2e872bd0429448cba81477bb8a250 100644 (file)
@@ -345,7 +345,7 @@ window_is_tracked (MetaWindow *window)
 }
 
 /**
- * window_is_usage_tracked:
+ * shell_app_monitor_is_window_usage_tracked:
  *
  * Determine if it makes sense to track the given window for application
  * usage.  An example of a window we don't want to track is the root
@@ -358,8 +358,8 @@ window_is_tracked (MetaWindow *window)
  *
  * Returns: %TRUE iff we want to record focus time spent in this window
  */
-static gboolean
-window_is_usage_tracked (MetaWindow *window)
+gboolean
+shell_app_monitor_is_window_usage_tracked (MetaWindow *window)
 {
   if (!window_is_tracked (window))
     return FALSE;
@@ -562,7 +562,7 @@ get_active_window (ShellAppMonitor *monitor)
   display = meta_screen_get_display (screen);
   window = meta_display_get_focus_window (display);
 
-  if (window != NULL && window_is_usage_tracked (window))
+  if (window != NULL && shell_app_monitor_is_window_usage_tracked (window))
     return window;
   return NULL;
 }
@@ -756,7 +756,7 @@ track_window (ShellAppMonitor *self,
    * tracked it doesn't count for the purposes of an application
    * running.
    */
-  if (!window_is_usage_tracked (window))
+  if (!shell_app_monitor_is_window_usage_tracked (window))
     return;
 
   usage = get_app_usage_from_window (self, window);
@@ -812,7 +812,7 @@ disassociate_window (ShellAppMonitor   *self,
   if (window == self->watched_window)
     self->watched_window = NULL;
 
-  if (window_is_usage_tracked (window))
+  if (shell_app_monitor_is_window_usage_tracked (window))
     {
       AppUsage *usage;
       const char *context;
@@ -930,7 +930,7 @@ shell_app_monitor_get_windows_for_app (ShellAppMonitor *self,
       ShellAppInfo *app = value;
       const char *id = shell_app_info_get_id (app);
 
-      if (!window_is_usage_tracked (window))
+      if (!shell_app_monitor_is_window_usage_tracked (window))
         continue;
 
       if (strcmp (id, appid) != 0)
@@ -1181,7 +1181,7 @@ shell_app_monitor_get_running_apps (ShellAppMonitor *monitor,
       if (strcmp (get_window_context (window), context) != 0)
         continue;
 
-      if (!window_is_usage_tracked (window))
+      if (!shell_app_monitor_is_window_usage_tracked (window))
         continue;
 
       id = shell_app_info_get_id (app);
index a56bd5e77d782b18568d7ad930012acfcd388f5e..efc1e9ac6bd32969cfde4365b5499c105cea6a6b 100644 (file)
@@ -44,6 +44,8 @@ GList *shell_app_monitor_get_most_used_apps (ShellAppMonitor *monitor,
 
 GSList *shell_app_monitor_get_windows_for_app (ShellAppMonitor *monitor, const char *appid);
 
+gboolean shell_app_monitor_is_window_usage_tracked (MetaWindow *window);
+
 /* Get whatever's running right now */
 GSList *shell_app_monitor_get_running_apps (ShellAppMonitor *monitor, const char *context);